package org.come.control;

import org.come.Frame.ForgeJframe;
import org.come.Jpanel.ForgeJpanel;
import org.come.action.FromServerAction;
import org.come.entity.Goodstable;
import org.come.lianhua.AutoMaticRefiningJframe;
import org.come.mouslisten.TransmuteMouslisten;
import org.come.until.GoodsListFromServerUntil;
import org.come.until.GsonUtil;

import com.tool.image.ImageMixDeal;

public class AddGoodControl implements FromServerAction {

	@Override
	public void controlMessFromServer(String mes, String type) {
		// TODO Auto-generated method stub
		Goodstable goodstable = GsonUtil.getGsonUtil().getgson().fromJson(mes, Goodstable.class);
		if (goodstable.getRole_id().compareTo(ImageMixDeal.userimg.getRoleShow().getRole_id()) != 0) {
			return;
		}
		if (goodstable.getUsetime() == null) {
            goodstable.setUsetime(1);
        }
		goodstable.setStatus(0);
		GoodsListFromServerUntil.addGood(goodstable);
		if(ForgeJframe.getForgejframe().isVisible() && TransmuteMouslisten.goods2[0] == null){
			ForgeJpanel forgejpanel = ForgeJframe.getForgejframe().getForgejpanel();
			forgejpanel.getGoodsListLabel()[24].setIcon(GoodsListFromServerUntil.imgpathAdaptive(goodstable.getSkin(), 49, 49));
			TransmuteMouslisten.goods2[0] = goodstable;
		}

		if(AutoMaticRefiningJframe.getAssistantJframe().isVisible()){
			AutoMaticRefiningJframe.getAssistantJframe().getAssistantJpanel().petShidetectionProperties(goodstable);
		}
	}
}
